<%--
  Created by IntelliJ IDEA.
  User: ghp
  Date: 2022/9/27
  Time: 9:43
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>pageContext</title>
</head>
<body>
<%
  //获取request对象
  HttpServletRequest req = (HttpServletRequest) pageContext.getRequest();
  //设置page范围内属性
  pageContext.setAttribute("str", "Java",pageContext.PAGE_SCOPE);
  //设置request范围内属性
  request.setAttribute("str","Java Web");
  //获取page的范围属性
  String str1 = (String)pageContext.getAttribute("str", pageContext.PAGE_SCOPE);
  //获得request的范围属性
  Object str2 = (String)pageContext.getAttribute("str", pageContext.REQUEST_SCOPE);
%>
<%="page范围："+str1 %><br />
<%="request范围："+str2 %><br />
</body>
</html>
